(function (vc) {
    vc.extends({
        propTypes: {
            emitChooseHousekeepingServFee: vc.propTypes.string,
            emitLoadData: vc.propTypes.string
        },
        data: {
            chooseHousekeepingServFeeInfo: {
                housekeepingServFees: [],
                servId:''
            }
        },
        _initMethod: function () {
        },
        _initEvent: function () {
            vc.on('chooseHousekeepingServFee', 'openChooseHousekeepingServFeeModel', function (_param) {
                $('#chooseHousekeepingServFeeModel').modal('show');
                $that.chooseHousekeepingServFeeInfo.servId = _param.servId;
                $that._loadHousekeepingServFees(1, 10);
            });
        },
        methods: {
            _loadHousekeepingServFees: function (_page, _row, _name) {
                var param = {
                    params: {
                        page: _page,
                        row: _row,
                        shopId: vc.getCurrentCommunity().shopId,
                        servId: $that.chooseHousekeepingServFeeInfo.servId
                    }
                };

                //发送get请求
                vc.http.apiGet('/housekeepingFeeConfig/queryHousekeepingServConfig',
                    param,
                    function (json) {
                        var _housekeepingFeeConfigInfo = JSON.parse(json);
                        $that.chooseHousekeepingServFeeInfo.housekeepingServFees = _housekeepingFeeConfigInfo.data;
                    }, function () {
                        console.log('请求失败处理');
                    }
                );
            },
            chooseHousekeepingServFee: function (_housekeepingFeeConfig) {
                vc.emit($props.emitChooseHousekeepingServFee, 'chooseHousekeepingServFee', _housekeepingFeeConfig);
                vc.emit($props.emitLoadData, 'listHousekeepingFeeConfigData', {
                    housekeepingFeeConfigId: _housekeepingFeeConfig.housekeepingFeeConfigId
                });
                $('#chooseHousekeepingServFeeModel').modal('hide');
            },
            queryHousekeepingServFees: function () {
                $that._loadHousekeepingServFees(1, 10);
            }
        }

    });
})(window.vc);
